package parser.news;

/**
 * Parser for getting news from IBM channel
 * User: kaiser
 * Date: 7/31/13
 * Time: 9:34 PM
 */
public class IbmParser extends ChannelParser {

    /**
     * Channel identifier name
     */
    public static final String CHANNEL_ID = "ibm-java-dev";

    /**
     * News resource url
     */
    protected final String RESOURCE = "http://www.ibm.com/developerworks/views/java/rss/libraryview.jsp?feed_by=rss";

    @Override
    protected NewsHandler getParserHandler() {
        return new NewsHandler() {

            @Override
            String getNewsTag() {
                return "item";
            }

            @Override
            String getNewsTitleTag() {
                return "title";
            }

            @Override
            String getNewsUrlTag() {
                return "link";
            }

            @Override
            String getNewsPublishDateTag() {
                return "pubDate";
            }

            @Override
            String getChannelId() {
                return CHANNEL_ID;
            }
        };
    }

    @Override
    protected String getChannelResourceLink() {
        return RESOURCE;
    }
}
